import {
  createRouter,
  createMemoryHistory,
  createWebHashHistory
} from 'vue-router'
/*
import {
  qiankunWindow
} from 'vite-plugin-qiankun/dist/helper';
*/
import Layout from '@/layout/index.vue'

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/datasource',
    children: [
      {
        path: '/datasource',
        component: () => import('@/views/datasource/index.vue'),
        name: 'Datasource',
        meta: {title: 'datasource', icon: 'datasource', affix: true}
      },
      {
        path: '/diff',
        component: () => import('@/views/diff/index.vue'),
        name: 'Diff',
        meta: {title: 'diff', icon: 'dashboard', affix: true}
      },
      {
        path: '/history',
        component: () => import('@/views/history/index.vue'),
        name: 'History',
        meta: {title: 'history', icon: 'history', affix: true}
      }
    ]
  }
]

let history
/*if (qiankunWindow.__POWERED_BY_QIANKUN__) {
  history = createWebHashHistory()
} else {
  history = createWebHashHistory()
}*/
history = createWebHashHistory()
const router = createRouter({
  history,
  routes
})

export default router
